package com.neusoft.zqygbc.neusoft_wenda.activity;

import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.neusoft.zqygbc.neusoft_wenda.R;
import com.neusoft.zqygbc.neusoft_wenda.utils.DataCleanManager;

public class CurrencyActivity extends BaseAvtivity {
    private LinearLayout ll_currency_return,ll_cache;
    private TextView text_cache;

    @Override
    void initViews() {
        setLayout(R.layout.activity_currency);
        ll_currency_return = (LinearLayout) findViewById(R.id.ll_currency_return);
        ll_cache = (LinearLayout) findViewById(R.id.ll_cache);
        text_cache = (TextView) findViewById(R.id.text_cache);
        try {
            text_cache.setText(DataCleanManager.getTotalCacheSize(getApplicationContext()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    void initEvents() {
        ll_currency_return.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        ll_cache.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DataCleanManager.clearAllCache(getApplicationContext());
                try {
                    text_cache.setText(DataCleanManager.getTotalCacheSize(getApplicationContext()));
                    Toast.makeText(getApplication(),"清理完成",Toast.LENGTH_SHORT).show();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });

    }

    @Override
    void initData() {

    }
}
